﻿
<div class="current-location">
    <ul>
        <li class="left"><i class="glyphicon glyphicon-home"></i><a href="javascript:void(0)" onclick="location.href=location.href">数据库备份</a></li>
        <li class="right"><a href="javascript:void(0)" onclick="LoadData()" title="刷新"><span class="glyphicon glyphicon-refresh"></span></a></li>
    </ul>
</div>

<div class="main">
    <table border=0 cellpadding=0 cellspacing=0 class="tb-head">
        <tr>
            <td>
                <div class="btn-group btn-group-sm">
                    <button type="button" class="btn btn-default btn-sm ui-selectInvert">反选</button>
                    <button type="button" class="btn btn-default dropdown-toggle btn-sm" data-toggle="dropdown" aria-expanded="false">
                        菜单
                        <span class="caret"></span>
                    </button>
                    <ul class="dropdown-menu" role="menu">
                        <li><a class="ui-ajaxRequest" href="javascript:void(0)" data-custom-params="type:'post',url:'@Url.ActionUrl("SqlBackup")',successMsg:'备份成功!',callBack:'LoadData'">备份数据库</a></li>
                        <li class="divider"></li>
                        <li><a class="ui-ajaxRequest" data-custom-params="type:'post', url:'@Url.ActionUrl("ClearSqlLog")',confirmMsg:'清理日志前，建议先备份数据库!',successMsg:'清理完毕!'" href="javascript:void(0)">清理日志</a></li>
                        <li class="divider"></li>
                        <li><a href="javascript:void(0)" class="ui-dialog" data-custom-params="title:'运行Sql',url:'@Url.ActionUrl("RunSql")',width:'80%',height:'80%'">运行Sql命令</a></li>
                        <li class="divider"></li>
                        <li><a href="javascript:void(0)" class="ui-deleteMultiple" data-custom-params="url:'@Url.ActionUrl("Delete")',beforeExecute:'BeforeExecuting',callBack:'LoadData'">删除</a></li>
                    </ul>
                </div>
            </td>
    </table>

    <table border=0 cellpadding=0 cellspacing=0 class="table table-bordered form-inline form-group-sm" id="tb_list">
        <thead>
            <tr>
                <td align="center" style="width:40px"><input type="checkbox" title="选择" class="ui-selectInvert" data-custom-params="isReverse:false"></td>
                <td align="center">备份文件</td>
                <td align="center">备份日期</td>
                <td align="center">文件大小</td>
                <td align="center">操作</td>
            </tr>
        </thead>
        <tr class="item list-template-item" id="item_{id}">
            <td align="center" width="30px"><input type="checkbox" value="{id}" class="checked-item"></td>
            <td align=left>{Name}</td>
            <td align="center">{CreationTime}</td>
            <td align="center">{FileLength}kb</td>
            <td align="center">
                <input type="hidden" name="name" id="name" value="{Name}" />
                <input type="hidden" name="type" id="type" value="{Type}" />
                <div class="btn-group btn-group-sm">
                    <a href="javascript:Open('{Name}')" class="btn btn-default btn-sm">下载</a>
                    <a href="javascript:void(0)" class="btn btn-default btn-sm ui-deleteSingle" data-custom-params="url:'@Url.ActionUrl("Delete")',additionals:'#path',callBack:'LoadData'">删除</a>
                </div>
            </td>
        </tr>
    </table>

</div>
<script type="text/javascript">
    function LoadData()
    {
       $("#tb_list").ListBind({ url: "@Url.ActionUrl("ListData")" });
    }
    LoadData();

   function Open(thisPath){
       var currentPath = "@ViewBag.RootPath";
        if (currentPath != "") {
            thisPath = currentPath + "/" + thisPath;
        }
       window.open("@Url.ActionUrl("DownFile")?path=" + thisPath, "_target");
    }
</script>